class myServlet extends HttpServlet{

    protected void service(HttpServletRequest request,HttpServletResponse response)
	throws ServletException,IOException{
	    request.setCharacterEncoding("utf-8");
		response.setContentType("html/text;charset=utf-8");

        String value = request.getParameter("name");

		request.getRequestDispatcher("").forward(request,response);

		response.sendRedirect("");

        Cookie cookie = new Cookie("name","vlaue");
		cookie.setMaxAge(n);
		cookie.setPath(str);
		reponse.addCookie(cookie);

        Cookie cook[] = request.getCookies();
		if(cook != null){
		    for(Cookie c:cook){
			    String name = c.getName();
				String vlaue = c.getValue();
				System.out.println(name+":"+value);
			}
		}
        
		HttpSession session = request.getSession();
		session.setMaxInactiveInterval(n);
		session.invalidate();

        ServletContext servletContext1 = this.getServletContext();
		ServletContext servletContext2 = request.getSession().getServletContext();
		ServletContext servletContext3 = this.getServletConfig().getServletContext();

		ServletConfig servletConfig = this.getServletConfig();

	}


